<template>
  <div class="index">
    <nav-header></nav-header>
    <div class="contentK">
      <div class="menu">
        <menu-list v-if="this.$store.state.whichModule === 0"></menu-list>
        <menu-for-homework
          v-if="this.$store.state.whichModule === 1"
          :chapterData="chapterData"
          :homeworkData="homeworkData"
        ></menu-for-homework>
      </div>
      <div class="content">
        <router-view></router-view>
      </div>
    </div>
  </div>
</template>

<script>
import navHeader from '../components/navHeaderS'
import menuList from '../components/menuS'
import menuForHomework from '../components/homeworkManage/menuForHomework.vue'

export default {
  name: 'index',
  components: {
    navHeader,
    menuList,
    menuForHomework,
  },
  mounted() {
    this.axios.defaults.headers.common[
      'Authorization'
    ] = window.sessionStorage.getItem('token')
    this.axios.post('/course/query_all/').then(res => {
      this.chapterData = res
    })
    this.axios.post('/assess/query_work_list/').then(res => {
      this.homeworkData = res
    })
  },
  data() {
    return {
      showPage: '',
      chapterData: [],
      homeworkData: [],
    }
  },
  methods: {},
}
</script>

<style lang="scss">
.index {
  .contentK {
    display: flex;
    .menu {
      height: calc(100vh - 65px);
      width: 256px;
      background-color: rgba(204, 204, 204, 0.096);
    }
    .content {
      flex: 1;
    }
  }
}
</style>
